<template>
  <!-- 用于测试滚动条 可删除 -->
  <div class="create_vedio">
    <!-- @delVedioFun="delVedioFun" -->
    <vedio
      ref="productVedioRef"
      :refname="productVedioRef"
      v-bind="videoProps"
      v-model="defaultVedio"
      @del-vedio-fun="handleDelete"
    ></vedio>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import vedio from "../../a-components/vedio/index.vue";
import { Path } from "@/api/modules/upload.ts";

const props = defineProps<{
  id: string | number;
}>();

const videourl = ref("/goods-archive/product-edit/upload-video");
let defaultVedio = ref({}); //初始化默认数据
const productVedioRef = ref(null);

const videoProps = reactive({
  path: videourl,
  multiple: false,
  isEmpty:false,
  toastBool:true,
  tipMsgRequire: "支持mp4格式，文件大小不超过20M",
  listType: "picture-card", //默认央视
  uploadClass: "picUpload" //默认cl
});

const handleDelete = value => {
  console.log(value);
  defaultVedio.value = {};
  productVedioRef.value.delChangeFile();
};

defineExpose({
  getVedioData: () => {
    console.log(defaultVedio.value);
    return Promise.resolve(defaultVedio.value);
  },
  resetVedio: () => {
    defaultVedio.value = {};
  }
});

onMounted(() => {});
</script>

<style  lang="scss">
.create_vedio .upload_moudle{
  margin-bottom: 0px !important;
}
</style>
